package StudyCode.summary.myfile;

import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.attribute.UserDefinedFileAttributeView;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class DefineFileUserAttribute {
	public static void main(String[] args) {
		Path path = Paths.get("E:\\迅雷下载", "test1.txt");
		UserDefinedFileAttributeView udfav = Files.getFileAttributeView(path,
				UserDefinedFileAttributeView.class);
		try {
			udfav.write("file.description", Charset.defaultCharset().encode("www.tah1986.com"));
			System.out.println("文件描述信息写入成功。");
		} catch (IOException e) {
			System.err.println(e);
		}
	}
}
